package com.hlhj.funlike_businessqzxd.moudle;

import android.content.Context;

import com.example.mymvp.mvp.BaseModule;
import com.hlhj.funlike_businessqzxd.api.Apis;
import com.hlhj.funlike_businessqzxd.api.BaseObser;
import com.hlhj.funlike_businessqzxd.bean.LoginBean;
import com.lzy.okgo.model.Response;

public class LoginMoudle implements BaseModule{
    public interface getLoginResult{
        void showResult(LoginBean loginBean);
    }

    public getLoginResult listener;

    public void setListener(getLoginResult listener) {
        this.listener = listener;
    }

    public void LoginResult(Context context,String login,String password){
        Apis.INSTANCE.Login(login,password)
                .subscribe(new BaseObser<Response<LoginBean>>(context) {
                    @Override
                    public void httpSuccess(Response<LoginBean> loginBeanResponse) {
                        if (listener!=null){
                            listener.showResult(loginBeanResponse.body());
                        }
                    }
                });
    }
}
